Skip to main content
  1. Posts/

Restic backup and Windows paths

·2 mins
a man with a backpack is lost in a maze, the maze walls look like computer parts, photo realistic

I recently stumbled upon restic and since I haven’t really setup a backup of my windows machine1, I wanted to give it a try.

I love it 💛 The software is straight to the point, not bloated and using it in a terminal is a bonus for me!

However, there was one pitfall with windows paths (and I’m not even surprised by this):

  • When you select the folder for the backup, you can choose absolute or relative paths.
  • The backup snapshot will always show the absolute path.
  • Additionally, the path in the snapshot view will be displayed in Windows style (with a colon and backward slashes).
  • The path in the actual backup will vary depending on your backup command and can only be displayed with ls
# Backup C:\Users\restic_demo\Git with an absolute path (ID b713711c)
PS C:\Users\restic_demo> restic -r .\Backup\ backup C:\Users\restic_demo\Git\

# Backup C:\Users\restic_demo\Git with a relative path (ID da8fe3c7)
PS C:\Users\restic_demo> restic -r .\Backup\ backup .\Git\

# Display restic snapshots
PS C:\Users\restic_demo> restic -r .\Backup\ snapshots
repository ebfaab05 opened (version 2, compression level auto)
ID        Time                 Host        Tags        Paths
--------------------------------------------------------------------------
b713711c  2023-09-30 21:47:58  Horscht               C:\Users\restic_demo\Git
da8fe3c7  2023-09-30 22:03:19  Horscht               C:\Users\restic_demo\Git
--------------------------------------------------------------------------

# Display snapshot files and folders for b713711c
PS C:\Users\restic_demo> restic -r .\Backup\ ls b713711c
enter password for repository:
repository ebfaab05 opened (version 2, compression level auto)
snapshot b713711c of [C:\Users\restic_demo\Git] filtered by [] at 2023-09-30 21:47:58.6977882 +0200 CEST):
/C
/C/Users
/C/Users/restic_demo
/C/Users/restic_demo/Git
/C/Users/restic_demo/Git/blog.bdw.li
/C/Users/restic_demo/Git/blog.bdw.li/.git

# Display snapshot files and folders for da8fe3c7
PS C:\Users\restic_demo> restic -r .\Backup\ ls da8fe3c7
enter password for repository:
repository ebfaab05 opened (version 2, compression level auto)
snapshot da8fe3c7 of [C:\Users\restic_demo\Git] filtered by [] at 2023-09-30 22:03:19.7184899 +0200 CEST):
/Git
/Git/blog.bdw.li
/Git/blog.bdw.li/.git

I no case would I be able to restore the data using the path from the snapshot view C:\Users\restic_demo\Git. It took me a few confused minutes to figure that out. And I didn’t find anything about it in the docs. At last in the Github issue #2792 was a side note that mentioned the proper paths.


  1. A synchronized nextcloud folder ist not a backup ╰( ̄ω ̄o) ↩︎

jwb
Author
jwb
Something-ops during the day, nowadays mostly asleep during the night.